{	Problem: http://codeforces.ru/problemset/problem/48/A
	Verdict: Accepted

}
var a,b,c:byte; s1,s2,s3:string; r:char;
begin
readln(s1);
readln(S2);
readln(s3);
if s1='rock' then a:=1 else
if s1='paper' then a:=2 else a:=3;
if s2='rock' then b:=1 else
if s2='paper' then b:=2 else b:=3;
if s3='rock' then c:=1 else
if s3='paper' then c:=2 else c:=3;
if (a=b) and (a=c) then r:='?' else
if (a<>b) and (a<>c) and (b<>c) then r:='?' else
if (a=b) and (a=1) and (c=3) then r:='?' else
if (a=b) and (a=1) and (c=2) then r:='S' else
if (a=b) and (a=2) and (c=3) then r:='S' else
if (a=b) and (a=2) and (c=1) then r:='?' else
if (a=b) and (a=3) and (c=1) then r:='S' else
if (a=b) and (a=3) and (c=2) then r:='?' else
if (b=c) and (b=1) and (a=3) then r:='?' else
if (b=c) and (b=1) and (a=2) then r:='F' else
if (b=c) and (b=2) and (a=3) then r:='F' else
if (b=c) and (b=2) and (a=1) then r:='?' else
if (b=c) and (b=3) and (a=1) then r:='F' else
if (b=c) and (b=3) and (a=2) then r:='?' else
if (a=c) and (A=1) and (b=3) then r:='?' else
if (a=c) and (A=1) and (b=2) then r:='M' else
if (a=c) and (A=2) and (b=3) then r:='M' else
if (a=c) and (A=2) and (b=1) then r:='?' else
if (a=c) and (A=3) and (b=1) then r:='M' else
if (a=c) and (A=3) and (b=2) then r:='?';
writeln(r);
end.